unit Helper.WindowSettings;

interface

uses
  Forms;

type
  TWindowSettings = class
  public
    class procedure SaveWindowPos(aForm : TForm);
    class procedure LoadWindowPos(aForm : TForm);
  end;

implementation

uses
  Helper.Config;

{ TWindowSettings }

class procedure TWindowSettings.LoadWindowPos(aForm: TForm);
begin
  aForm.Left := TConfig.App.readInteger(aForm.Name,'Left',10);
  aForm.Top := TConfig.App.readInteger(aForm.Name,'Top',10);
  aForm.Width := TConfig.App.readInteger(aForm.Name,'Width',800);
  aForm.Height := TConfig.App.readInteger(aForm.Name,'Height',600);
end;

class procedure TWindowSettings.SaveWindowPos(aForm: TForm);
begin
  TConfig.App.write(aForm.Name,'Left',aForm.Left);
  TConfig.App.write(aForm.Name,'Top',aForm.Top);
  TConfig.App.write(aForm.Name,'Width',aForm.Width);
  TConfig.App.write(aForm.Name,'Height',aForm.Height);
end;

end.
